package com.databaseconnectionmobilapi.util.util;

public class StringUtil {
    /**
     * 设置首字母大写
     * @param str
     * @return
     */
    public static String uppercase(String str) {
        char[] arr = str.toCharArray();
        arr[0] = Character.toUpperCase(arr[0]);
        return new String(arr);
    }

    public static boolean stringMatch(String motherString, String modeString) {
        if (modeString.length() > motherString.length()) {
            return false;
        }

        char[] motherChars = motherString.toCharArray();
        char[] modeChars = modeString.toCharArray();

        for (char c : motherChars) {
            for (char c1 : modeChars) {
                if (c == c1) {
                    return true;
                }
            }
        }

        return false;
    }

    public static Integer getUserId(String userId) {
        return Integer.parseInt(userId.substring("userId".length()));
    }
}
